import getState from "@/api/state";
import ZuiEchart from "@/template/zuiEchart/zuiEchart";
import React from "react"
import { useEffect } from "react";
import { useState } from "react";


const FxqModule4 = ({ condition }) => {
    const [message, setMessage] = useState("");
    const [loading, setLoading] = useState(true);
    const [state1, setState1] = useState({
        dayList: [],
        data: []
    })
    const [state2, setState2] = useState({
        dayList: [],
        data: []
    })



    useEffect(() => {
        getState({
            moduleName: "suspiciousLastYear",
            apiUrl: "/cifgp-core-api/fxqQuery/fxqSuspicious",
            condition: { ...condition, cType: "fxqSuspicious", dateType: "tYear", statDate: condition.dateType === "tYear" ? condition.statDate : "" },
            state: state1,
            setState: setState1,
            setLoading,
            setMessage,
        })
        getState({
            moduleName: "suspiciousLastMonth",
            apiUrl: "/cifgp-core-api/fxqQuery/fxqSuspicious",
            condition: { ...condition, cType: "fxqSuspicious", dateType: "tMonth", statDate: condition.dateType === "tMonth" ? condition.statDate : null },
            state: state1,
            setState: setState2,
            setLoading,
            setMessage,
        })
    }, [condition])

    return (
        <>
            <ZuiEchart
                message={message}
                condition={condition}
                authSwitch={true}
                loading={loading}
                data={[
                    state1,
                    state2
                ]}
                style={{ width: "33.33333%" }}
                title="可疑交易趋势"
                useXis
                defaultModule="adBar"
                btn={["年", "月"]}
            />
        </>
    )
}

export default FxqModule4;